package example;

import com.plupload.model.TemporaryFile;
import com.plupload.util.FileTransferer;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

@ManagedBean(name = "UploadController")
@ViewScoped
public class UploadController {
    private static final String SEP = System.getProperty("file.separator");
    private static final String WEB_PATH = FacesContext.getCurrentInstance().getExternalContext().getRealPath(File.separator);
    
    private List<TemporaryFile> files;
    
    public UploadController(){
        files = new ArrayList<TemporaryFile>();
    }

    /**
     * @return the files
     */
    public List<TemporaryFile> getFiles() {
        return files;
    }

    /**
     * @param files the files to set
     */
    public void setFiles(List<TemporaryFile> files) {
        this.files = files;
    }
    
    public void upload(){
        System.out.println(files.size());
        //FileTransferer.transferTemporaryFiles(files, WEB_PATH + SEP + "uploaded");
        //return "success";
    }
}
